/*
 * ReqReader.java
 *January 6, 2014, Finals
 * Finals Completion Project
 * 
 * The following codes are the work of the IT.WORKS team in   
 * fulfillment of the requirement for Programming Applications
 * class code 9607. Copying of this work will result to 
 * serious consequences both to the IT.WORKs team and the plagiarizing 
 * party
 */

import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * This program reads requirements for the A+ Student Scheduler Application
 *
 * @author 2132446 Matib,Nicole
  * @edited by 2132446
 *		-  added date line
 *
 * @version 2.0.6
 */
public class ReqReader {

    private String temp[];
    private Text words;
    public ArrayList<Text> coll;
    public int count = 0;

    public ReqReader() {
        File file = new File("Requirements.txt");

        try {

            Scanner reader = new Scanner(file);
            coll = new ArrayList<Text>();
            while (reader.hasNext()) {
                temp = reader.nextLine().split(",");
                words = new Text(temp[0], temp[1], temp[2], Integer.parseInt(temp[3]), Integer.parseInt(temp[4]), Integer.parseInt(temp[5]),
                        Integer.parseInt(temp[6]), Integer.parseInt(temp[7]), temp[8]);
                coll.add(words);
                count = count + 1;
            }
        } catch (FileNotFoundException fnfe) {
        }

    }

    public int countRows() {
        return count;
    }

    public String readName(int row) {
        return coll.get(row).getName();
    }

    public String readSubject(int row) {
        return coll.get(row).getSubject();
    }

    public String readType(int row) {
        return coll.get(row).getType();
    }

    public int readDay(int row) {
        return coll.get(row).getDay();
    }

    public int readMonth(int row) {
        return coll.get(row).getMonth();
    }

    public int readYear(int row) {
        return coll.get(row).getYear();
    }

    public int readHour(int row) {
        return coll.get(row).getToHour();
    }

    public int readMin(int row) {
        return coll.get(row).getToMin();
    }

    public int readDiv(int row) {
        if (coll.get(row).getTimeDiv().matches("AM")) {
            return 0;
        }
        return 1;
    }
}